import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class ListView1 extends StatelessWidget {
  const ListView1({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // 1. 导航条
      appBar: AppBar(
        title: const Text(
          '列表使用-方式1',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      body: ListView(
        // 控制视图的滚动方向
        // scrollDirection:Axis.horizontal, // 水平
        // scrollDirection: Axis.vertical, // 水平
        // 让ListView禁止滚动
        // physics: const NeverScrollableScrollPhysics(),
        children: [
          Container(
            height: 80,
            color: Colors.red,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件1'),
          ),
          Container(
            height: 100,
            color: Colors.cyan,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件2'),
          ),
          Container(
            height: 120,
            color: Colors.purple,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件3'),
          ),
          Container(
            height: 140,
            color: Colors.blue,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件4'),
          ),
          Container(
            height: 180,
            color: Colors.green,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件5'),
          ),
          Container(
            height: 200,
            color: Colors.red,
            alignment: Alignment.center,
            child: const Text('鸿蒙大事件6'),
          )
        ],
      ),
    );
  }
}
